package com.sh.data.engine.domain.integration.offline.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sh.data.engine.domain.integration.offline.model.domain.*;
import com.sh.data.engine.repository.dao.integration.offline.entity.OfflineSyncRunningRecordEntity;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

public interface OfflineSyncRunningRecordService extends IService<OfflineSyncRunningRecordEntity> {
    /**
     * 编辑+保存离线同步任务运行记录
     */
    Integer getOfflineSyncLastType(Long offlineSyncId);

    Long saveOfflineRunningRecord(OfflineSyncRunningRecordDomain domain);


    void updateRunningRecord(OfflineSyncRunningRecordDomain domain);

    /**
     * 获取离线同步运行记录分页
     *
     * @return PageResult<OfflineSyncRunningRecordDomain>
     */
    IPage<OfflineSyncRunningRecordDomain> page(Integer status, Integer pageNum, Integer pageSize);

    void clearAMonthAgoRecord(Date time);

    void updateOfflineSyncRunningStatus();

    IPage<OfflineSyncOperationTaskMonitorErrorTaskDomain> getTaskMonitorErrorTask(Long projectId,
                                                                                  Integer timeCase, Integer pageNum, Integer pageSize);

    OfflineSyncOperationTaskMonitorDomain getTaskMonitorError(Long projectId);

    List<OfflineSyncOperationRunningTimeTopDomain> getRunningTimeTop(Long projectId, LocalDate date);

    List<OfflineSyncOperationFailedTopDomain> getFailedTaskTop(Long projectId, Integer timeType);

    OfflineSyncOperationTodayFinishedDomain getTodayFinished(Long projectId);

    OfflineSyncOperationSummaryDomain getOfflineSyncSummary(Long projectId);

    Boolean ignoreOfflineSyncRunning(String ids);

    JSONObject getOfflineSyncStatus(Long recordId);
}
